<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>javascript 阶段</title>
</head>
<body>


    <script>
      function Cat () {
          this.name = "汤姆";
          this.color = "蓝色";
          this.catch = function() {
              var str = "<h1>穿" +this.color + "衣服的" +this.name +  "正在抓老鼠</h1>";
              document.write(str);
          }
      }  
      var o1 = new Cat();
      console.log(o1);
      o1.catch();

      function Mouse () {
          this.name = "杰瑞";
          this.color = "棕色";
          this.catch = function() {
              var str = "<h1>穿" +this.color + "衣服的" +this.name +  "正在逃跑</h1>";
              document.write(str);
          }
      }  
      var o2 = new Mouse();
      console.log(o2);
      o2.catch();

    </script>
</body>
</html>